export interface msgDataItem {
  id: string;
  content: string;
  type: string;
  status: boolean;
  collected: boolean;
  date: string;
  quality: string;
}
// 定义的state初始值
const state: { msgData: Array<msgDataItem> } = {
  msgData: [
    {
      id: '1',
      content: 'v300测试计划运行成功，请查看运行结果！',
      type: '测试计划',
      status: true,
      collected: false,
      date: '2023-08-28 08:00',
      quality: 'high',
    },
    {
      id: '2',
      content: 'v300测试计划运行成功，请查看运行结果！！',
      type: '测试计划',
      status: true,
      collected: false,
      date: '2023-08-27 08:00',
      quality: 'low',
    },
  ],
};

const mutations = {
  setMsgData(state, data) {
    // eslint-disable-next-line no-param-reassign
    state.msgData = data;
  },
};

const getters = {
  unreadMsg: (state) => state.msgData.filter((item) => item.status),
  readMsg: (state) => state.msgData.filter((item) => !item.status),
};

const actions = {};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
};
